/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ctrl.jeu;

import java.io.Serializable;

/**
 *
 * @author Willy
 */
public class Place implements Serializable, Comparable<Place>{
    protected  int id;
    protected static int idCourant=0;
    protected Joueur player=null;
    protected float MontantPartie;
    protected int IdChaise=-1;
    protected Carte[] card=new Carte[2];

    public Place()
    {
        
    }
    public Place(float MontantPartie) {
        this.id = idCourant;
        idCourant++;
        this.MontantPartie = MontantPartie;
    }

    public Place(float MontantPartie, Joueur J) {
        this.id = idCourant;
        idCourant++;
        this.MontantPartie = MontantPartie;
        this.player=J;
    }

    public Place(float MontantPartie, Joueur J, int IdChaise) {
        this.id = IdChaise;
        idCourant++;
        this.MontantPartie = MontantPartie;
        this.player=J;
        this.IdChaise=IdChaise;
    }
    

    public int getId() {
        return id;
    }

    public int getIdChaise() {
        return IdChaise;
    }

    public void setIdChaise(int IdChaise) {
        this.IdChaise = IdChaise;
    }

    public Carte[] getCard() {
        return card;
    }

    public void setCard(Carte[] card) {
        this.card = card;
    }
    

    public float getMontantPartie() {
        return MontantPartie;
    }

    public void setMontantPartie(float MontantPartie) {
        this.MontantPartie = MontantPartie;
    }

    public Joueur getPlayer() {
        return player;
    }

    public void setPlayer(Joueur player) {
        this.player = player;
    }

    

    @Override
    public String toString() {
        return "("+getId()+"): idCh= "+getIdChaise();
    }

    @Override
    public boolean equals(Object obj) {
        if(obj instanceof Place) return ((Place) obj).getId()==this.getId();
        return false;
    }

    public Carte[] getCarteJeu(Carte[] fl,Carte tr,Carte riv)
    {
        int k=0;
        Carte[] fin=new Carte[7];
        for(int i=0;i<2;i++,k++) fin[k]=this.getCard()[i];
        for(int i=0;i<3;i++,k++) fin[k]=fl[i];
        fin[5]=tr;
        fin[6]=riv;

        return fin;
    }

    public int compareTo(Place o) {
        return this.getIdChaise()-o.getIdChaise();
    }



}
